from django.utils.deprecation import MiddlewareMixin


#  跨域解决
class MyCors(MiddlewareMixin):

    def process_response(self, request, response):
        response["Access-Control-Allow-Origin"] = "*"
        if request.method == "OPTIONS":  # 复杂请求的跨域
            response["Access-Control-Allow-Methods"] = "PUT, DELETE"
            response["Access-Control-Allow-Headers"] = "Content-Type,ACCOUNTTOKEN"
            # response['Access-Control-Allow-Headers'] = '*'

        return response
